package com.huawei.appgallery.forum.posts.buoy.action;

import android.app.Activity;
import android.content.Intent;
import com.huawei.appgallery.assistantdock.base.externalaction.openviewaction.IOpenViewAction;
import com.huawei.appgallery.forum.option.api.IUpdateCommentActivityProtocol;
import com.huawei.appgallery.forum.option.api.IUpdateCommentActivityResult;
import com.huawei.secure.android.common.intent.SafeIntent;
import o.bqx;
import o.byg;
import o.byl;
import o.dys.a;
import o.fho;
import o.fiu;
import o.fjb;
import o.fjc;
import o.fjf;

public class OpenModifyCommentAction extends IOpenViewAction {
    public static final String ACTION_OPEN_FORUM_POST_MODIFY = "com.huawei.appgallery.forum.comments.ACTION_OPEN_FORUM_POST_MODIFY";
    private static final int REQUEST_CODE = 10001;
    private static final String TAG = "OpenModifyCommentAction";
    private static c modifyCommentCallBack;

    public interface c {
        void ˏ(IUpdateCommentActivityResult iUpdateCommentActivityResult);
    }

    public OpenModifyCommentAction(a aVar, SafeIntent safeIntent) {
        super(aVar, safeIntent);
    }

    public void onAction() {
        bqx.ˏ(TAG, "modify comment action");
        if (this.callback instanceof Activity) {
            fjb ˎ = fho.ˏ().ˋ("Option").ˎ("option.update.comment");
            IUpdateCommentActivityProtocol iUpdateCommentActivityProtocol = (IUpdateCommentActivityProtocol) ˎ.ˊ();
            if (this.intent.getExtras().getString("DomainId") != null) {
                iUpdateCommentActivityProtocol.setDomainId(this.intent.getExtras().getString("DomainId"));
            }
            byg o_byg = new byg(this.intent.getExtras().getLong(OpenDeleteCommentAction.BUNDLE_COMMENTID), this.intent.getExtras().getString("CommentContent"), (byl) this.intent.getExtras().getSerializable("ImageData"));
            o_byg.ॱ(this.intent.getExtras().getLong(OpenDeleteCommentAction.BUNDLE_COMMENTID));
            iUpdateCommentActivityProtocol.setCommentData(o_byg);
            fiu.ˊ().ॱ((Activity) this.callback, ˎ, new fjc<IUpdateCommentActivityResult>(this) {
                final /* synthetic */ OpenModifyCommentAction ˏ;

                {
                    this.ˏ = r1;
                }

                public /* synthetic */ void ˎ(int i, Object obj) {
                    ˋ(i, (IUpdateCommentActivityResult) obj);
                }

                public void ˋ(int i, IUpdateCommentActivityResult iUpdateCommentActivityResult) {
                    bqx.ˏ(OpenModifyCommentAction.TAG, "modify comment result:" + i);
                    if (i == -1 && iUpdateCommentActivityResult != null) {
                        OpenModifyCommentAction.modifyCommentCallBack.ˏ(iUpdateCommentActivityResult);
                    }
                }
            });
        }
    }

    public void onActivityResult(int i, int i2, Intent intent) {
        if (i == 10001 && i2 == -1) {
            dealWithData(intent);
        }
    }

    private void dealWithData(Intent intent) {
        notifyResult((IUpdateCommentActivityResult) fjf.ˋ(intent).ॱ());
    }

    public static synchronized void registerCall(c cVar) {
        synchronized (OpenModifyCommentAction.class) {
            modifyCommentCallBack = cVar;
        }
    }

    private static synchronized void notifyResult(IUpdateCommentActivityResult iUpdateCommentActivityResult) {
        synchronized (OpenModifyCommentAction.class) {
            if (modifyCommentCallBack != null) {
                modifyCommentCallBack.ˏ(iUpdateCommentActivityResult);
            }
        }
    }
}
